# coding=utf-8


"""This is a wrapper for element requests"""

from pypalo.basic import response, url, default, arguments

request_group="element"

def append(children, element, dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/append[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of an element. The element must be a consolidation.>
		children [identifier] <Comma separate list of children identifiers.>
		weights [double] <Optional comma separate list of children weight. (defaults to weight=1 for each child)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/append
	'''
	#beginning of function suite
	request_name="append"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def create(new_name, type, dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/create[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		new_name [string] <Name of the new element>
		type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		children [identifier] <Comma separate list of children identifiers.>
		weights [double] <Optional comma separate list of children weight. (defaults to weight=1 for each child)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/create
	'''
	#beginning of function suite
	request_name="create"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def create_bulk(name_elements, dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/create_bulk[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		name_elements [string] <Comma separate list of names of the new elements>
		type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED). Either type or types must be specified, bot not both.>
		types [integer] <Type of the elements (1=NUMERIC, 2=STRING, 4=CONSOLIDATED) as comma separated list. Either type or types must be specified. If type is specified, all elements are of the same type. If types is specified, then children and weights must be empty for elements of numeric or string type. If types is specified, only name_children is allowed.>
		children [identifier] <Comma and colon separate list of children identifiers. (Only for type=4)>
		name_children [identifier] <Comma and colon separate list of children names. Used only if children parameter is omitted. (Only for type=4)>
		weights [double] <Optional comma and colon separate list of children weight. (defaults to weight=1 for each child) (Only for type=4)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result: !!! No info at http://host:port/api/element/create_bulk
	Result: for http://host:port/api/element/create:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/create_bulk
	'''
	#beginning of function suite
	request_name="create_bulk"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def destroy(element, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/destroy[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of the element>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/element/destroy
	'''
	#beginning of function suite
	request_name="destroy"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def destroy_bulk(dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/destroy_bulk[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		elements [string] <Comma separated list of element identifiers>
		name_elements [string] <Comma separated list of element names. Used only if elements parameter is omitted.>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/element/destroy_bulk
	'''
	#beginning of function suite
	request_name="destroy_bulk"
	#end of function suite
	return response(url(host, port, request_group, request_name. arguments(locals())))

def info(element, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/info[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of an element>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/info
	'''
	#beginning of function suite
	request_name="info"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def move(position, element, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/move[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of an element>
		position [integer] <New position of element>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/move
	'''
	#beginning of function suite
	request_name="move"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def rename(new_name, element, dimension, database, sid, host=default["host"], port=default["port"]):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/rename[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of a database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of an element>
		new_name [string] <New name of the element>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>
	
	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/rename
	'''
	#beginning of function suite
	request_name="rename"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def replace(dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/replace[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		element [identifier] <Identifier of an element>
		name_element [string] <Name of an element. (alternative parameter for "element")>
		type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		children [identifier] <Comma separate list of children identifiers. (Only for type=4)>
		weights [double] <Optional comma separate list of children weight. (defaults to weight=1 for each child) (Only for type=4)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 element [identifier] <Identifier of the element>
		1 name_element [string] <Name of the element>
		2 position [integer] <Position of the element>
		3 level [integer] <Level of the element>
		4 indent [integer] <Indent of the element>
		5 depth [integer] <Depth of the element>
		6 type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		7 number_parents [integer] <Number of parents>
		8 parents [identifier] <Comma separate list of parent identifiers>
		9 number_children [integer] <Number of children>
		10 children [identifier] <Comma separate list of children identifiers>
		11 weights double [Comma separate list of children weight
	
	More info at http://host:port/api/element/replace
	'''
	#beginning of function suite
	request_name="replace"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

def replace_bulk(dimension, database, sid, host=default["host"], port=default["port"], **keywords):
	'''
	This function wraps PALO API Request
	http://[SERVER]:[PORT]/element/replace_bulk[?PARAMETER1=value[&...]].
	
	Parameters:
		database [identifier] <Identifier of the database>
		dimension [identifier] <Identifier of a dimension>
		elements [identifier] <Comma separate list of elements.>
		name_elements [string] <Comma separate list of name of an element. (alternative parameter for "elements")>
		type [integer] <Type of the element (1=NUMERIC, 2=STRING, 4=CONSOLIDATED)>
		children [identifier] <Comma and colon separate list of children identifiers. (Only for type=4)>
		weights [double] <Optional comma and colon separate list of children weight. (defaults to weight=1 for each child) (Only for type=4)>
		sid [string] <Session identifier for a server connection. Use the /server/login request to get a valid session identifier.>

	Result:
		0 OK [boolean] <"1" means OK>
	
	More info at http://host:port/api/element/replace_bulk
	'''
	#beginning of function suite
	request_name="replace_bulk"
	#end of function suite
	return response(url(host, port, request_group, request_name, arguments(locals())))

#querys dictionary
query={}
query["append"]=append
query["create"]=create
query["create_bulk"]=create_bulk
query["destroy"]=destroy
query["destroy_bulk"]=destroy_bulk
query["info"]=info
query["move"]=move
query["rename"]=rename
query["replace"]=replace
query["replace_bulk"]=replace_bulk

#end of element module suite